package com.neutech.controller;

import com.neutech.service.DepartmentService;
import com.neutech.service.PatientService;
import com.neutech.service.SchedulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
public class PatientController {
//    @Autowired
//    private MenuService menuService;
    /*******************医生___START*************************/
    @Autowired
    private PatientService patientService;
    @RequestMapping("/queryPatient")
    public List<Map<String,Object>> getPatient(){
        return patientService.queryPatient();
    }
    @RequestMapping("/insertPatient")
    public void insPatient(@RequestParam Map  map){
        System.out.println("sad");
        System.out.println(map);
        Map<String,Object> map2 = new HashMap<>();
        map2.put("patid",map.get("patid"));
        map2.put("name",map.get("name"));
        map2.put("gender",map.get("gender"));
        map2.put("id_information",map.get("id_information"));
        map2.put("password",map.get("password"));
        map2.put("tel",map.get("tel"));
        patientService.insertPatient(map2);
    }
    @RequestMapping("/deletePatient")
    public void delPatient(@RequestParam Map  map){
        patientService.deletePatient(map);
        System.out.println(map.get("patid"));
    }
    @RequestMapping("/updataPatient")
    public void updDoctor(@RequestParam Map  map){
        System.out.println("看这里");
        System.out.println(map);
        System.out.println("看这里");
//        Map<String,Object> map2 = new HashMap<>();
//        map2.put("docid",map.get("docid"));
//        map2.put("name",map.get("name"));
//        map2.put("depid",map.get("depid"));
//        map2.put("account",map.get("account"));
//        map2.put("password",map.get("password"));
//        map2.put("level",map.get("level"));
//        map2.put("quota",map.get("quota"));
//        map2.put("fees",map.get("fees"));

        patientService.updataPatient(map);
    }
    /**************************END*******************************/

}
